package com.ecfront.util;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.ecfront.util.email.MailUtil;

public class ContextLoaderListener extends
		org.springframework.web.context.ContextLoaderListener {
	
    public void contextInitialized(ServletContextEvent event) { 
    	//重写父类方法
        super.contextInitialized(event); 
  
        ServletContext context = event.getServletContext();   
  
        ApplicationContext ctx = WebApplicationContextUtils   
                .getRequiredWebApplicationContext(context);   
         
        String realpath = context.getRealPath("/");   

        MailUtil.setSystemPath(realpath);
        
    }  

}
